<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>流程控制语句</title>
</head>
<body>
<script>
    /*
    * if...else...
    * switch:
    *           java中可以接受的数据类型，byte，int，short，char，枚举，string
    *           js中什么类型都可以
    *   switch(){case 值1；break；else 值；break；}
    * while
    * do...while
    * for
    *
    *
    * */
    /*  var a=5;
      switch (a) {
          case 1:
              alert("number");
              break;
          case "abc":
              alert("string");
              break;
          case null:
              alert("null");
              break;
          case true:
              alert("boolean");
              break;
          case undefined:
              alert("undefined");
              break;
          default:
              alert("sss");
              break;

      }*/
    /*
    * while:
    *
    * */
    var sum1 = 0;
    var num1 = 1;
/*    while(num <= 100)
    {
        sum += num;
        num++;
    }
    // alert(sum);
    /!*
    * for
    *
    * *!/

    for (var i = 0; i <=100 ; i++) {
        sum+=i;
    }
  /!*  alert(sum);*!/
    /!*
    * do...while
    *
    * *!/*/
do{
    sum1+=num1;
    num1++;
}while (num1<=100)
alert(sum1);
</script>
</body>
</html>